package servlet;

import java.io.IOException;

import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import service.BookService;
import vo.BookBean;

public class nameservlet extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		   resp.setContentType("application/json;charset=utf-8");
		   PrintWriter w = resp.getWriter();
		   String b_name = req.getParameter("name");
		   JSONObject j=new JSONObject();   
		   BookService list=new BookService();
		  List<Object> book =list.getxinxi(b_name);
		  j.put("name", book);  
		  w.write(j.toString());
		  w.close();
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}
}
